package com.chenxin.wms.controller;

import com.chenxin.common.annotation.Log;
import com.chenxin.common.core.controller.BaseController;
import com.chenxin.common.core.page.TableDataInfo;
import com.chenxin.common.enums.BusinessType;
import com.chenxin.common.utils.poi.ExcelUtil;
import com.chenxin.wms.domain.vo.WcsTaskVO;
import com.chenxin.wms.service.IWcsTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 搬送指令Controller
 *
 * @author loujf
 * @date 2025-06-18
 */
@RestController
@RequestMapping("/wms/toWcsTask")
public class WcsTaskController extends BaseController {
    @Autowired
    private IWcsTaskService toWcsTaskService;

    /**
     * 查询搬送指令列表
     */
    @PreAuthorize("@ss.hasPermi('wms:toWcsTask:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcsTaskVO wcsTaskVO) {
        startPage();
        List<WcsTaskVO> list = toWcsTaskService.selectToWcsTaskList(wcsTaskVO);
        return getDataTable(list);
    }

    /**
     * 导出搬送指令列表
     */
    @PreAuthorize("@ss.hasPermi('wms:toWcsTask:export')")
    @Log(title = "搬送指令", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WcsTaskVO wcsTaskVO) {
        List<WcsTaskVO> list = toWcsTaskService.selectToWcsTaskList(wcsTaskVO);
        ExcelUtil<WcsTaskVO> util = new ExcelUtil<>(WcsTaskVO.class);
        util.exportExcel(response, list, "搬送指令数据");
    }
}
